<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        let s=Symbol();
        console.log(s);
        let s1=Symbol();
        console.log(s,s1);
        console.log(s===s1);    //false

        //带有描述符的创建
        let name1=Symbol("name");
        let name2=Symbol("name");
        console.log(name1,name2);
        console.log(name1===name2);  //false

        //使用symbol模拟私有属性
        let a=Symbol("name");
        let b=Symbol("age");
        let obj={
            [a]:"小明",
            [b]:"18"
        }
        console.log(obj[a]);
        console.log(obj[b]);
    </script>
</body>
</html>